package com.eShopManager.web.action;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.eShopManager.intigration.ebay.EbayFacade;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class GenTokenAction extends ActionSupport {

	private static final long serialVersionUID = -7198449244030432487L;
	private EbayFacade ebayFacade;
	private String runame;
	private String signInURL;

	public void setEbayFacade(EbayFacade ebayFacade) {
		this.ebayFacade = ebayFacade;
	}

	public void setRuname(String runame) {
		this.runame = runame;
	}

	public void setSignInURL(String signInURL) {
		this.signInURL = signInURL;
	}

	@Override
	public String execute() throws Exception {
		String sessionID = ebayFacade.getSessionID();
		ActionContext.getContext().getSession().put("sessionID", sessionID);
		HttpServletResponse response = ServletActionContext.getResponse();
		response.sendRedirect(signInURL + "&runame=" + runame + "&sessid="
				+ sessionID + "&ruparams=");
		return null;
	}

}
